<?php
 
    function mydate($date)
    {
       $day=substr($date,8,2);
       $mymonth = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec');
       $month=substr($date,5,2);
       $year=substr($date,0,4);
       
       $temp=$day.' '.$mymonth[$month-1].' '.$year;
       
       return $temp;
    } 
 
 
    echo "<div id='myjob'>";
    
        echo "<div id='company'>"; 
            echo "<div id='logo'><a href='../../employers/view/".$data['Employer']['id']."'>".$html->image('../'.$data['Employer']['logo'],array('style'=>'border:none;'))."</a></div>";
            echo "<div id='name'>".$data['Employer']['company_name']."</div></a>";
            if($data['Employer']['website']!='')
            { echo "<div id='website'><a href='".$data['Employer']['website']."'>".$data['Employer']['website']."</a></div>"; }
        echo "</div>";   
    
        echo "<div id='isi'>";
            
            if($data['Job']['status']==1)
            { echo "<div id='mydate'> Posted date : ".mydate($data['Job']['created'])." | Close date : ".mydate($data['Job']['end_date'])."</div>"; }
            else
            { echo "<div id='mydate'> Created : ".mydate($data['Job']['created'])."</div>"; }
            
            
            if($data['Job']['behaviour']==2)
            { echo "<div id='urgent' align='center'>".$data['Job']['urgent']."</div>"; }
            
            if($data['Job']['behaviour']==3)
            { echo "<div id='urgent'><marquee>".$data['Job']['urgent']."</marquee></div>"; }

            echo "<div id='desc'>".$data['Job']['desc']."</div>";
            echo "<div id='position'>".$data['Job']['position']."</div>";

            if ( $data['Job']['jobdesc']!= '' )
            {
                echo "<div id='judul'>Jobs Description</div>";
                echo "<div id='jobdesc'>".$data['Job']['jobdesc']."</div>"; 
            }
            
            if ( $data['Job']['criteria']!= '' )
            {
                echo "<div id='judul'>Requirements / Quailifications</div>";
                echo "<div id='criteria'>".$data['Job']['criteria']."</div>"; 
            }
            
            if ( $data['Job']['note']!= '' )
            { echo "<div id='note'>".$data['Job']['note']."</div>"; }
        
        echo "</div>";
        
        
        echo "<div id='keterangan'>";
            if($data['Job']['entry']==1)
            { echo "<label>Career Level</label> Entry Level"; }
            if($data['Job']['middle']==1)
            { echo "<label>Career Level</label> Middle Level"; }
            if($data['Job']['senior']==1)
            { echo "<label>Career Level</label> Senior Level"; }
            if($data['Job']['top']==1)
            { echo "<label>Career Level</label> Top Level"; }
            echo "<br>";
            echo "<label>Academic Qualification</label> ".$data['Academic']['name'];
            echo "<br>";
            echo "<label>Job Location</label> ".$data['City']['name'];
            echo "<br>";
            if($data['Job']['experience']==0)
            { echo "<label>Years Experience</label> N/A"; }
            else
            { echo "<label>Years Experience</label>".$data['Job']['experience']." year(s)"; }
            echo "<br>";
            
            if($data['Job']['salary']==0)
            { echo "<label>Salary</label> ".SALARY_0; }
            if($data['Job']['salary']==1)
            { echo "<label>Salary</label> ".SALARY_1; }
            if($data['Job']['salary']==2)
            { echo "<label>Salary</label> ".SALARY_2; }
            if($data['Job']['salary']==3)
            { echo "<label>Salary</label> ".SALARY_3; }
            if($data['Job']['salary']==4)
            { echo "<label>Salary</label> ".SALARY_4; }
            echo "<br>";
            
            $temp='';
           echo "<label>Type work</label>"; 
           if($data['Job']['parttime']==1) 
           { $temp.=" Part Time,"; }
           if($data['Job']['fulltime']==1) 
           { $temp.=" Full Time,"; }
           if($data['Job']['freelance']==1) 
           { $temp.=" Freelance,"; }
           if($data['Job']['contract']==1) 
           { $temp.=" Contract,"; }
           if($data['Job']['temporary']==1) 
           { $temp.=" Temporary"; }
           $temp=substr($temp,0,strlen($temp)-1);
           echo $temp;
           echo "<br>";
           
           $temp='';
           echo "<label>Job Category</label>";
           foreach($data['Field'] as $field)
           { $temp.= " ".$field['name'].","; }
           $temp=substr($temp,0,strlen($temp)-1);
           echo $temp;           
                    
        echo "</div>";
		?>
		<style>
			td{
				padding:4px 2px 4px 2px;
			}
		</style>
		<table border="1" style="border-collapse:collapse;border-radius:10px;margin-top:10px;margin-bottom:10px;">
			<thead>
				<tr>
					<td style="background:grey;text-align:center;color:#ffffff;">Kemampuan yang dibutuhkan</td>
				</tr>
			</thead>
			<tbody>
				<?php
				$query	= mysql_query("SELECT * FROM job_requirements JOIN skills ON skills.id = job_requirements.skill_id WHERE job_id = '" . $id . "'");
				while($row=mysql_fetch_array($query)){
				?>
				<tr>
					<td><?php echo $row["name"]; ?></td>
				</tr>
				<?php
				}
				?>
			</tbody>
		</table>
		<?php
    echo "</div>";
?>